#pragma once
#include <streams.h>

class CMiiShowPinIn : public CBaseInputPin,  public CCritSec
{
public:
    //CCritSec m_tLock;
	CMediaType m_tType;

public:
	enum SampleMediaType
	{
		RGB565,
		YV12
	};
	CMiiShowPinIn(CBaseFilter *pFilter, HRESULT *phr,int width,int hight);
	virtual ~CMiiShowPinIn();
    STDMETHODIMP_(ULONG) NonDelegatingAddRef();
	STDMETHODIMP_(ULONG) NonDelegatingRelease();
public:
    HRESULT CheckMediaType(const CMediaType *pmt);
	HRESULT GetMediaType(int iPosition, CMediaType *pMediaType);
	HRESULT CompleteConnect(IPin *pReceivePin);
	CMediaType *MediaType();

    HRESULT SetMediaType(const CMediaType *);
    HRESULT CheckConnect(IPin *);

public:
    STDMETHODIMP Receive(IMediaSample *pSample);
public:
	VIDEOINFO m_vInfo;
	char *m_pBuffer[2];
	int m_nBufIndex;
public:
	// get picture from the pin
	void GetPicture(char ** pBuffer, int* width, int* height, int* bitCount, int* color);
protected:
    int mOutWidth, mOutHeight;
	int mTimeStamp;
	bool m_bCopy;
	SampleMediaType m_mediaType;
	int m_nResolutionWidth;
	int m_nResolutionHeight;
	int m_nMaxCount;
};

